Skip to content

fix(core): sync __drizzle_migrations when behind migration table#35406

Open
Bmasele wants to merge 1 commit into
anomalyco:devfrom
Bmasele:fix-migration-sync
Open

fix(core): sync __drizzle_migrations when behind migration table#35406
Bmasele wants to merge 1 commit into
anomalyco:devfrom
Bmasele:fix-migration-sync

Conversation

@Bmasele

@Bmasele Bmasele commented Jul 5, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #35403

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The existing migration reconciliation only seeds the migration table from __drizzle_migrations -- not the reverse. When the CLI binary auto-updates past the plugin's migration count, __drizzle_migrations falls behind. The task tool then fails because Drizzle's tracker doesn't know about columns added by later migrations.

After the existing forward-seed (where an empty migration table is populated from the old Drizzle journal), this adds a reverse-sync that backfills any migration IDs present in the migration table but missing from __drizzle_migrations. Uses sequential IDs after the current max, with 'synced' as hash.

How did you verify your code works?

Applied the equivalent SQL manually on a real database where migration had 38 entries and __drizzle_migrations had 21. After the backfill, both tables were in sync and the task tool ran without errors.

Screenshots / recordings

N/A -- non-UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Jul 5, 2026
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Bmasele

Bmasele commented Jul 5, 2026

Copy link
Copy Markdown
Author

Updated the description with proper checkboxes per the PR template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

task tool fails with "no such column: replacement_seq" when plugin lags behind CLI

1 participant